package cn.zsb.basic;

import java.util.ArrayList;
import java.util.Scanner;

public class arraylist {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        ArrayList<student> list = new ArrayList<>();
        for (int i = 0; i < 3; i++) {
            student s = new student();
            System.out.println("姓名");
            String name = sc.next();
            System.out.println("年龄");
            int age = sc.nextInt();
            s.setName(name);
            s.setAge(age);

            list.add(s);
        }
        System.out.print("[");
        for (student s : list) {
            System.out.print(s.getName() + ", " + s.getAge());
        }
        System.out.println("]");
    }
}
